package com.sky.java.basic;

import java.util.Random;
import java.util.Scanner;

public class JavaLearnDemo1 {
    public static void main(String[] args) {
        Random r = new Random();
        int num = r.nextInt(100)+1;

        Scanner sc = new Scanner (System.in);

        while(true){
            System.out.println("请输入猜测的数字");
            int tem = sc.nextInt();
            if(tem < num){
                System.out.println("您猜的数字过小~~");

            }else if(tem > num){
                System.out.println("您猜的数字过大~~");

            }else{
                System.out.println("恭喜你，猜对啦~~");
                break;
            }
        }
    }
}
